(() => {
    // class Person {
    //     name: string = "John Doe";
    //     sex : string = "女";
    //     age : number = 18;
    //     static name: string = "king";
    //     run () {
    //         console.log("run");
    //     }
    // }

    // const p = new Person();

    // console.log(p.name); // John Doe
    // p.name = "Alice";
    // p.run();
    // console.log(p.name); // Alice

    //泛型实例：
    function createArray<T>(value: T, count: number): T[] {
        const arr: T[] = [];
        for (let i = 0; i < count; i++) {
            arr.push(value);
        }
        return arr;
    }
    const arr = createArray("hello", 5);
    console.log(arr); // ["hello", "hello", "hello", "hello", "hello"]
    const arr2 = createArray(123, 3);
    console.log(arr2); // [123, 123, 123]
    const arr3 = createArray(true, 2);
    console.log(arr3); // [true, true]
    const arr4 = createArray({ name: "Alice" }, 7);
    console.log(arr4); // [{ name: "Alice" }]
    const arr5 = createArray([1, 2, 3], 4);
    console.log(arr5); // [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
    console.log('====================================');
    console.log("最新隔断编辑的文件：");
    console.log('====================================');

    function swap<T, U>(a: T, b: U): [U, T] {
        return [b, a];
    }
    console.log(swap<string, number>("afternoon", 812));

    interface Person {
        name: string;
        age: number;
        serect?: string;
    }

    const p: Person = {
        name: "John",
        age: 30
    };
    
    console.log(p);
})();